#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
int s[8010];
int main(){
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	int n,q;
	scanf("%d %d",&n,&q);
	int f;
	for(int i=1;i<=n;i++){
		scanf("%d",&s[i]);
	}
	for(int k=1;k<=q;k++){
		scanf("%d",&f);
		if(f==1){
			int x,v;
			scanf("%d %d",&x,&v);
			s[x] = v;
		}
		else if(f==2){
			int x;
			scanf("%d",&x);
			int ans=1;
			for(int i=1;i<=n;i++){
				if(s[i]<=s[x]&&i<x) ans++;
				else if(s[i]<s[x]&&i>x) ans++;
				else if(i==x) continue;
			}
			printf("%d\n",ans);
		}
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}
